<template>
	<view class="page">
		<view v-for="(item, index) in list" :key="index" class="list">
			<view class="item">
				<view class="itemleft">
					<view class="time">{{item.add_time_txt}}</view>
					<view class="desc">
						{{item.desc}}
					</view>
				</view>
				<view class="sum">{{item.amount}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPersonalCenter,
	} from "../../api/index.js"
	export default {
		data() {
			return {
				logType: 0,
				info: {},
				list: [],
				pagenum: 1
			}
		},
		async onLoad(opt) {
			this.logType = opt.logType;
			await this.getList();
		},
		onReachBottom() {
			this.pagenum += 1
			this.getList()
		},
		onPullDownRefresh() {
			this.pagenum = 1
			this.getList();

			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			async getList() {
				console.log({
					bid: this.bid,
					logtype: this.logType,
					pagenum: this.pagenum
				})
				const res = await getPersonalCenter('s=ApiZwyRequest/incomedetaillog', {
					logtype: this.logType,
					pagenum: this.pagenum
				}, true)
				const {
					datalist,
					status,
					msg
				} = res.data

				console.log(res)
				this.pagenum > 1 ? this.list.push(...datalist) : this.list = datalist

			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #efefef;
	}

	.list {
		margin: 10rpx 5%;
		padding: 10rpx;
		background-color: white;
		border-radius: 10rpx;
		display: flex;
		flex-direction: column;

		.item {
			flex: 1;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;

			.itemleft {

				.time {
					font-size: 28rpx;
					color: #333;
				}

				.desc {
					margin-top: 5rpx;
					font-size: 28rpx;
					color: #333;
				}
			}



			.sum {
				text-align: center;
				font-size: 48rpx;
				font-weight: bold;
				color: #774f9b;
				margin-bottom: 20rpx;
			}
		}


	}
</style>